<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="robots" content="noodp" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
        <title>《Flutter中的底部导航栏切换》 - Lucklyの博客 - 在阅读中遇见自己</title><meta name="Description" content="早起的年轻人做的网站"><meta property="og:title" content="《Flutter中的底部导航栏切换》" />
<meta property="og:description" content="
本文主要介绍flutter中的底部导航栏切换
" />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://luckly.work/flutter/" />
<meta property="og:image" content="https://luckly.work/logo.png"/>
<meta property="article:published_time" content="2021-07-31T12:11:03+08:00" />
<meta property="article:modified_time" content="2021-07-31T12:11:03+08:00" />
<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:image" content="https://luckly.work/logo.png"/>

<meta name="twitter:title" content="《Flutter中的底部导航栏切换》"/>
<meta name="twitter:description" content="
本文主要介绍flutter中的底部导航栏切换
"/>
<meta name="application-name" content="LoveIt">
<meta name="apple-mobile-web-app-title" content="LoveIt"><meta name="theme-color" content="#ffffff"><meta name="msapplication-TileColor" content="#da532c"><link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
        <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
        <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"><link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"><link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5"><link rel="manifest" href="/site.webmanifest"><link rel="canonical" href="https://luckly.work/flutter/" /><link rel="prev" href="https://luckly.work/android%E7%B3%BB%E5%88%973%E5%AD%A6%E4%B9%A0%E8%B7%AF%E7%BA%BF/" /><link rel="next" href="https://luckly.work/flutterstate%E7%94%9F%E5%91%BD%E5%91%A8%E6%9C%9F/" /><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/normalize.css@8.0.1/normalize.min.css"><link rel="stylesheet" href="/css/style.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.13.0/css/all.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/animate.css@3.7.2/animate.min.css"><script type="application/ld+json">
    {
        "@context": "http://schema.org",
        "@type": "BlogPosting",
        "headline": "《Flutter中的底部导航栏切换》",
        "inLanguage": "zh-CN",
        "mainEntityOfPage": {
            "@type": "WebPage",
            "@id": "https:\/\/luckly.work\/flutter\/"
        },"image": [{
                            "@type": "ImageObject",
                            "url": "https:\/\/luckly.work\/images\/Apple-Devices-Preview.png",
                            "width":  3200 ,
                            "height":  2048 
                        }],"genre": "posts","keywords": "flutter","wordcount":  886 ,
        "url": "https:\/\/luckly.work\/flutter\/","datePublished": "2021-07-31T12:11:03+08:00","dateModified": "2021-07-31T12:11:03+08:00","license": "This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.","publisher": {
            "@type": "Organization",
            "name": "xxxx","logo": {
                    "@type": "ImageObject",
                    "url": "https:\/\/luckly.work\/images\/avatar.png",
                    "width":  528 ,
                    "height":  560 
                }},"author": {
                "@type": "Person",
                "name": "早起的年轻人"
            },"description": ""
    }
    </script></head>
    <body header-desktop="fixed" header-mobile="auto"><script type="text/javascript">(window.localStorage && localStorage.getItem('theme') ? localStorage.getItem('theme') === 'dark' : ('auto' === 'auto' ? window.matchMedia('(prefers-color-scheme: dark)').matches : 'auto' === 'dark')) && document.body.setAttribute('theme', 'dark');</script>

        <div id="mask"></div><div class="wrapper"><div class="logo-wrapper">
  <a href="/%20/" class="logo">Lucklyの博客 - 在阅读中遇见自己</a>
</div>

<nav class="site-navbar">
  <ul id="menu" class="menu">
    <li class="menu-item">
      <a class="menu-item-link" href="/posts/">所有文章</a>
    </li><li class="menu-item">
      <a class="menu-item-link" href="/categories/flutter/">Flutter</a>
    </li><li class="menu-item">
      <a class="menu-item-link" href="/categories/read/">读书笔记</a>
    </li><li class="menu-item">
      <a class="menu-item-link" href="/categories/go/">Go</a>
    </li><li class="menu-item">
      <a class="menu-item-link" href="/tags/">标签</a>
    </li><li class="menu-item">
      <a class="menu-item-link" href="/categories/">分类</a>
    </li><li class="menu-item">
      <a class="menu-item-link" href="/about/">关于</a>
    </li><li class="menu-item">
      <a class="menu-item-link" href="https://github.com/ITmxs">Github</a>
    </li><li class="menu-item">
      <a class="menu-item-link" href="/friend/">友链</a>
    </li>
  </ul>
</nav><main class="main">
                <div class="container"><div class="toc" id="toc-auto">
            <h2 class="toc-title">目录</h2>
            <div class="toc-content" id="toc-content-auto"></div>
        </div><article class="page single"><h1 class="single-title animated flipInX">《Flutter中的底部导航栏切换》</h1><div class="post-meta">
            <div class="post-meta-line"><span class="post-author"><a href="/" title="Author" rel=" author" class="author"><i class="fas fa-user-circle fa-fw"></i>早起的年轻人</a></span>&nbsp;<span class="post-category">收录于 <a href="/categories/flutter/"><i class="far fa-folder fa-fw"></i>Flutter</a></span></div>
            <div class="post-meta-line"><i class="far fa-calendar-alt fa-fw"></i>&nbsp;<time datetime="2021-07-31">2021-07-31</time>&nbsp;<i class="fas fa-pencil-alt fa-fw"></i>&nbsp;约 886 字&nbsp;
                <i class="far fa-clock fa-fw"></i>&nbsp;预计阅读 2 分钟&nbsp;</div>
        </div><div class="featured-image"><img
        class="lazyload"
        src="/svg/loading.min.svg"
        data-src="https://luckly007.oss-cn-beijing.aliyuncs.com/img/90c6cc12-742e-4c9f-b318-b912f163b8d0.png"
        data-srcset="https://luckly007.oss-cn-beijing.aliyuncs.com/img/90c6cc12-742e-4c9f-b318-b912f163b8d0.png, https://luckly007.oss-cn-beijing.aliyuncs.com/img/90c6cc12-742e-4c9f-b318-b912f163b8d0.png 1.5x, https://luckly007.oss-cn-beijing.aliyuncs.com/img/90c6cc12-742e-4c9f-b318-b912f163b8d0.png 2x"
        data-sizes="auto"
        alt="https://luckly007.oss-cn-beijing.aliyuncs.com/img/90c6cc12-742e-4c9f-b318-b912f163b8d0.png"
        title="https://luckly007.oss-cn-beijing.aliyuncs.com/img/90c6cc12-742e-4c9f-b318-b912f163b8d0.png" /></div><div class="details toc" id="toc-static"  kept="">
                <div class="details-summary toc-title">
                    <span>目录</span>
                    <span><i class="details-icon fas fa-angle-right"></i></span>
                </div>
                <div class="details-content toc-content" id="toc-content-static"><nav id="TableOfContents">
  <ul>
    <li>
      <ul>
        <li><a href="#效果">效果</a></li>
        <li><a href="#解析">解析</a>
          <ul>
            <li><a href="#单独界面-categorydart">单独界面 Category.dart</a></li>
            <li><a href="#底部导航栏-tabsdart">底部导航栏 tabs.dart</a></li>
            <li><a href="#主界面-bottomdart">主界面 bottom.dart</a></li>
            <li><a href="#思考">思考</a></li>
          </ul>
        </li>
      </ul>
    </li>
  </ul>
</nav></div>
            </div><div class="content" id="content"><blockquote>
<p>本文主要介绍flutter中的底部导航栏切换</p>
</blockquote>
<p>做android原生开发时，底部导航栏是通过自定义布局，图片自己上网找，点击之后还要变色，在切换的时候使用fragment，切换下一个的同时上一个隐藏……
现在，来看flutter怎么实现吧</p>
<h2 id="效果">效果</h2>
<p><img
        class="lazyload"
        src="/svg/loading.min.svg"
        data-src="https://uploadfiles.nowcoder.com/images/20200417/2967044_1587086806427_1A53AE36C08AE1F9B30B36167817C9C2"
        data-srcset="https://uploadfiles.nowcoder.com/images/20200417/2967044_1587086806427_1A53AE36C08AE1F9B30B36167817C9C2, https://uploadfiles.nowcoder.com/images/20200417/2967044_1587086806427_1A53AE36C08AE1F9B30B36167817C9C2 1.5x, https://uploadfiles.nowcoder.com/images/20200417/2967044_1587086806427_1A53AE36C08AE1F9B30B36167817C9C2 2x"
        data-sizes="auto"
        alt="https://uploadfiles.nowcoder.com/images/20200417/2967044_1587086806427_1A53AE36C08AE1F9B30B36167817C9C2"
        title="img" /></p>
<h2 id="解析">解析</h2>
<p>除了主界面以外，必然需要这三个界面，界面布局如下
<img
        class="lazyload"
        src="/svg/loading.min.svg"
        data-src="https://uploadfiles.nowcoder.com/images/20200417/2967044_1587086806688_D983E5605585C98765348B4A1E3FE2B4"
        data-srcset="https://uploadfiles.nowcoder.com/images/20200417/2967044_1587086806688_D983E5605585C98765348B4A1E3FE2B4, https://uploadfiles.nowcoder.com/images/20200417/2967044_1587086806688_D983E5605585C98765348B4A1E3FE2B4 1.5x, https://uploadfiles.nowcoder.com/images/20200417/2967044_1587086806688_D983E5605585C98765348B4A1E3FE2B4 2x"
        data-sizes="auto"
        alt="https://uploadfiles.nowcoder.com/images/20200417/2967044_1587086806688_D983E5605585C98765348B4A1E3FE2B4"
        title="img" />
然后还需要一个<strong>bottom.dart</strong>表示主界面，<strong>tabs.dart</strong>表示底部栏以及调用上面三个界面，所以总共五个dart文件，不需要资源文件</p>
<h3 id="单独界面-categorydart">单独界面 Category.dart</h3>
<p>每一个界面很简单，只需要显示有色方块即可，用同一个模板，如 分类界面，显示绿色的框</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre class="chroma"><code><span class="lnt"> 1
</span><span class="lnt"> 2
</span><span class="lnt"> 3
</span><span class="lnt"> 4
</span><span class="lnt"> 5
</span><span class="lnt"> 6
</span><span class="lnt"> 7
</span><span class="lnt"> 8
</span><span class="lnt"> 9
</span><span class="lnt">10
</span><span class="lnt">11
</span><span class="lnt">12
</span><span class="lnt">13
</span><span class="lnt">14
</span><span class="lnt">15
</span><span class="lnt">16
</span><span class="lnt">17
</span><span class="lnt">18
</span></code></pre></td>
<td class="lntd">
<pre class="chroma"><code class="language-dart" data-lang="dart"><span class="k">import</span> <span class="s1">&#39;package:flutter/material.dart&#39;</span><span class="p">;</span>
<span class="kd">class</span> <span class="nc">CategoryPage</span> <span class="kd">extends</span> <span class="n">StatefulWidget</span><span class="p">{</span>
  <span class="n">CategoryPage</span><span class="p">({</span><span class="n">Key</span> <span class="n">key</span><span class="p">})</span><span class="o">:</span><span class="k">super</span> <span class="p">(</span><span class="nl">key:</span><span class="n">key</span><span class="p">);</span>
  <span class="n">_CategoryPageState</span> <span class="n">createState</span><span class="p">()</span><span class="o">=&gt;</span><span class="n">_CategoryPageState</span><span class="p">();</span>
<span class="p">}</span>

<span class="kd">class</span> <span class="nc">_CategoryPageState</span> <span class="kd">extends</span> <span class="n">State</span><span class="o">&lt;</span><span class="n">CategoryPage</span><span class="o">&gt;</span><span class="p">{</span>
  <span class="err">@</span><span class="n">override</span>
  <span class="n">Widget</span> <span class="n">build</span><span class="p">(</span><span class="n">BuildContext</span> <span class="n">context</span><span class="p">)</span> <span class="p">{</span>
    <span class="c1">// TODO: implement build
</span><span class="c1"></span>    <span class="k">return</span> <span class="n">Container</span><span class="p">(</span>
      <span class="nl">width:</span> <span class="m">300</span><span class="p">,</span>
      <span class="nl">height:</span> <span class="m">300</span><span class="p">,</span>
      <span class="nl">color:</span> <span class="n">Colors</span><span class="p">.</span><span class="n">green</span><span class="p">,</span>
    <span class="p">);</span>
  <span class="p">}</span>
<span class="p">}</span>

</code></pre></td></tr></table>
</div>
</div><p>另外两个类似</p>
<h3 id="底部导航栏-tabsdart">底部导航栏 tabs.dart</h3>
<p>bottomNavigationBar组件，可以直接显示底部按钮，onTap方法进行交互,
setState方法可以实时渲染修改界面，currentIndex表示当前按下的位置</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre class="chroma"><code><span class="lnt"> 1
</span><span class="lnt"> 2
</span><span class="lnt"> 3
</span><span class="lnt"> 4
</span><span class="lnt"> 5
</span><span class="lnt"> 6
</span><span class="lnt"> 7
</span><span class="lnt"> 8
</span><span class="lnt"> 9
</span><span class="lnt">10
</span><span class="lnt">11
</span><span class="lnt">12
</span><span class="lnt">13
</span><span class="lnt">14
</span><span class="lnt">15
</span><span class="lnt">16
</span><span class="lnt">17
</span><span class="lnt">18
</span><span class="lnt">19
</span><span class="lnt">20
</span><span class="lnt">21
</span><span class="lnt">22
</span><span class="lnt">23
</span><span class="lnt">24
</span><span class="lnt">25
</span><span class="lnt">26
</span><span class="lnt">27
</span><span class="lnt">28
</span><span class="lnt">29
</span><span class="lnt">30
</span><span class="lnt">31
</span><span class="lnt">32
</span><span class="lnt">33
</span><span class="lnt">34
</span><span class="lnt">35
</span><span class="lnt">36
</span><span class="lnt">37
</span><span class="lnt">38
</span><span class="lnt">39
</span><span class="lnt">40
</span><span class="lnt">41
</span><span class="lnt">42
</span><span class="lnt">43
</span><span class="lnt">44
</span><span class="lnt">45
</span><span class="lnt">46
</span><span class="lnt">47
</span><span class="lnt">48
</span><span class="lnt">49
</span><span class="lnt">50
</span><span class="lnt">51
</span><span class="lnt">52
</span><span class="lnt">53
</span><span class="lnt">54
</span><span class="lnt">55
</span><span class="lnt">56
</span></code></pre></td>
<td class="lntd">
<pre class="chroma"><code class="language-dart" data-lang="dart"><span class="k">import</span> <span class="s1">&#39;package:flutter/material.dart&#39;</span><span class="p">;</span>
<span class="k">import</span> <span class="s1">&#39;pages/Category.dart&#39;</span><span class="p">;</span>
<span class="k">import</span> <span class="s1">&#39;pages/Home.dart&#39;</span><span class="p">;</span>
<span class="k">import</span> <span class="s1">&#39;pages/Setting.dart&#39;</span><span class="p">;</span>

<span class="kd">class</span> <span class="nc">Tabs</span> <span class="kd">extends</span> <span class="n">StatefulWidget</span><span class="p">{</span>
  <span class="n">Tabs</span><span class="p">({</span><span class="n">Key</span> <span class="n">key</span><span class="p">})</span><span class="o">:</span><span class="k">super</span><span class="p">(</span><span class="nl">key:</span><span class="n">key</span><span class="p">);</span>
  <span class="n">_TabsState</span> <span class="n">createState</span><span class="p">()</span><span class="o">=&gt;</span><span class="n">_TabsState</span><span class="p">();</span>
<span class="p">}</span>

<span class="kd">class</span> <span class="nc">_TabsState</span> <span class="kd">extends</span> <span class="n">State</span><span class="o">&lt;</span><span class="n">Tabs</span><span class="o">&gt;</span><span class="p">{</span>
  <span class="kt">int</span> <span class="n">_currentIndex</span><span class="o">=</span><span class="m">0</span><span class="p">;</span>
  <span class="c1">//下面的三个方法都是三个界面的方法
</span><span class="c1"></span>  <span class="n">List</span> <span class="n">_pageList</span><span class="o">=</span><span class="p">[</span>
    <span class="n">HomePage</span><span class="p">(),</span>
    <span class="n">CategoryPage</span><span class="p">(),</span>
    <span class="n">SettingPage</span><span class="p">()</span>
  <span class="p">];</span>
  <span class="err">@</span><span class="n">override</span>
  <span class="n">Widget</span> <span class="n">build</span><span class="p">(</span><span class="n">BuildContext</span> <span class="n">context</span><span class="p">)</span> <span class="p">{</span>
    <span class="c1">// TODO: implement build
</span><span class="c1"></span>    <span class="k">return</span>
      <span class="n">Scaffold</span><span class="p">(</span>
        <span class="nl">appBar:</span> <span class="n">AppBar</span><span class="p">(</span>
          <span class="nl">title:</span> <span class="n">Text</span><span class="p">(</span><span class="s1">&#39;底部导航栏切换&#39;</span><span class="p">),</span>
        <span class="p">),</span>
        <span class="cm">/** * 切换底部导航栏的时候动态修改body内容 */</span>
        <span class="nl">body:</span><span class="k">this</span><span class="p">.</span><span class="n">_pageList</span><span class="p">[</span><span class="k">this</span><span class="p">.</span><span class="n">_currentIndex</span><span class="p">],</span>
        <span class="nl">bottomNavigationBar:</span> <span class="n">BottomNavigationBar</span><span class="p">(</span>
          <span class="nl">currentIndex:</span> <span class="k">this</span><span class="p">.</span><span class="n">_currentIndex</span><span class="p">,</span>
          <span class="c1">//实现底部导航栏点击选***能
</span><span class="c1"></span>          <span class="nl">onTap:</span> <span class="p">(</span><span class="kt">int</span> <span class="n">index</span><span class="p">){</span>
<span class="c1">// this._currentIndex=index;//不会重新渲染
</span><span class="c1"></span>            <span class="n">setState</span><span class="p">(()</span> <span class="p">{</span>
              <span class="k">this</span><span class="p">.</span><span class="n">_currentIndex</span><span class="o">=</span><span class="n">index</span><span class="p">;</span>
            <span class="p">});</span>
          <span class="p">},</span>
          <span class="nl">items:</span> <span class="p">[</span>
            <span class="n">BottomNavigationBarItem</span><span class="p">(</span>
                <span class="nl">icon:</span> <span class="n">Icon</span><span class="p">(</span><span class="n">Icons</span><span class="p">.</span><span class="n">home</span><span class="p">),</span>
                <span class="nl">title:</span> <span class="n">Text</span><span class="p">(</span><span class="s2">&#34;首页&#34;</span><span class="p">)</span>
            <span class="p">),</span>
            <span class="n">BottomNavigationBarItem</span><span class="p">(</span>
                <span class="nl">icon:</span> <span class="n">Icon</span><span class="p">(</span><span class="n">Icons</span><span class="p">.</span><span class="n">category</span><span class="p">),</span>
                <span class="nl">title:</span> <span class="n">Text</span><span class="p">(</span><span class="s2">&#34;分类&#34;</span><span class="p">)</span>
            <span class="p">),</span>
            <span class="n">BottomNavigationBarItem</span><span class="p">(</span>
                <span class="nl">icon:</span> <span class="n">Icon</span><span class="p">(</span><span class="n">Icons</span><span class="p">.</span><span class="n">settings</span><span class="p">),</span>
                <span class="nl">title:</span> <span class="n">Text</span><span class="p">(</span><span class="s2">&#34;我的&#34;</span><span class="p">)</span>
            <span class="p">)</span>
          <span class="p">],</span>
        <span class="p">),</span>
      <span class="p">);</span>
  <span class="p">}</span>
<span class="p">}</span>

</code></pre></td></tr></table>
</div>
</div><h3 id="主界面-bottomdart">主界面 bottom.dart</h3>
<p>其实很简单，只需要调用Tabs()即可，具体只是想分离代码模块</p>
<div class="highlight"><div class="chroma">
<table class="lntable"><tr><td class="lntd">
<pre class="chroma"><code><span class="lnt"> 1
</span><span class="lnt"> 2
</span><span class="lnt"> 3
</span><span class="lnt"> 4
</span><span class="lnt"> 5
</span><span class="lnt"> 6
</span><span class="lnt"> 7
</span><span class="lnt"> 8
</span><span class="lnt"> 9
</span><span class="lnt">10
</span><span class="lnt">11
</span><span class="lnt">12
</span><span class="lnt">13
</span><span class="lnt">14
</span></code></pre></td>
<td class="lntd">
<pre class="chroma"><code class="language-dart" data-lang="dart"><span class="k">import</span> <span class="s1">&#39;package:flutter/material.dart&#39;</span><span class="p">;</span>
<span class="k">import</span> <span class="s1">&#39;package:flutter_app/tabs.dart&#39;</span><span class="p">;</span>
<span class="kt">void</span> <span class="n">main</span><span class="p">()</span> <span class="o">=&gt;</span> <span class="n">runApp</span><span class="p">(</span><span class="n">MyApp</span><span class="p">());</span>

<span class="kd">class</span> <span class="nc">MyApp</span> <span class="kd">extends</span> <span class="n">StatelessWidget</span><span class="p">{</span>
  <span class="err">@</span><span class="n">override</span>
  <span class="n">Widget</span> <span class="n">build</span><span class="p">(</span><span class="n">BuildContext</span> <span class="n">context</span><span class="p">)</span> <span class="p">{</span>
    <span class="k">return</span> <span class="n">MaterialApp</span><span class="p">(</span>
      <span class="nl">home:</span><span class="n">Tabs</span><span class="p">()</span>
    <span class="p">);</span>
  <span class="p">}</span>
<span class="p">}</span>


</code></pre></td></tr></table>
</div>
</div><p>所有代码都在，直接运行即可</p>
<h3 id="思考">思考</h3>
<p>本质上，这个切换是用列表排好的，但是最好应该使用键值对的形式，可能flutter有类似的方法我还没学到吧，不过，以上从理解的简单程度和实现的简单程度都是碾压原生开发的！</p></div><div class="post-footer" id="post-footer">
    <div class="post-info">
        <div class="post-info-line">
            <div class="post-info-mod">
                <span>更新于 2021-07-31</span>
            </div>
            <div class="post-info-license"></div>
        </div>
        <div class="post-info-line">
            <div class="post-info-md"></div>
            <div class="post-info-share">
                <span><a href="javascript:void(0);" title="分享到 Twitter" data-sharer="twitter" data-url="https://luckly.work/flutter/" data-title="《Flutter中的底部导航栏切换》" data-hashtags="flutter"><i class="fab fa-twitter fa-fw"></i></a><a href="javascript:void(0);" title="分享到 Facebook" data-sharer="facebook" data-url="https://luckly.work/flutter/" data-hashtag="flutter"><i class="fab fa-facebook-square fa-fw"></i></a><a href="javascript:void(0);" title="分享到 Hacker News" data-sharer="hackernews" data-url="https://luckly.work/flutter/" data-title="《Flutter中的底部导航栏切换》"><i class="fab fa-hacker-news fa-fw"></i></a><a href="javascript:void(0);" title="分享到 Line" data-sharer="line" data-url="https://luckly.work/flutter/" data-title="《Flutter中的底部导航栏切换》"><i data-svg-src="https://cdn.jsdelivr.net/npm/simple-icons@2.14.0/icons/line.svg"></i></a><a href="javascript:void(0);" title="分享到 微博" data-sharer="weibo" data-url="https://luckly.work/flutter/" data-title="《Flutter中的底部导航栏切换》" data-image="https://luckly007.oss-cn-beijing.aliyuncs.com/img/90c6cc12-742e-4c9f-b318-b912f163b8d0.png"><i class="fab fa-weibo fa-fw"></i></a></span>
            </div>
        </div>
    </div>

    <div class="post-info-more">
        <section class="post-tags"><i class="fas fa-tags fa-fw"></i>&nbsp;<a href="/tags/flutter/">flutter</a></section>
        <section>
            <span><a href="javascript:void(0);" onclick="window.history.back();">返回</a></span>&nbsp;|&nbsp;<span><a href="/">主页</a></span>
        </section>
    </div>

    <div class="post-nav"><a href="/android%E7%B3%BB%E5%88%973%E5%AD%A6%E4%B9%A0%E8%B7%AF%E7%BA%BF/" class="prev" rel="prev" title="《Android系列3学习路线》"><i class="fas fa-angle-left fa-fw"></i>《Android系列3学习路线》</a>
            <a href="/flutterstate%E7%94%9F%E5%91%BD%E5%91%A8%E6%9C%9F/" class="next" rel="next" title="《Flutter—State生命周期》">《Flutter—State生命周期》<i class="fas fa-angle-right fa-fw"></i></a></div>
</div>
</article></div>
            </main><footer class="footer">
        <div class="footer-container"><div class="footer-line">由 <a href="https://gohugo.io/" target="_blank" rel="noopener noreffer" title="Hugo 0.79.1">Hugo</a> 强力驱动 | 主题 - <a href="https://github.com/dillonzq/LoveIt" target="_blank" rel="noopener noreffer" title="LoveIt 0.2.10"><i class="far fa-kiss-wink-heart fa-fw"></i> LoveIt</a>
                </div><div class="footer-line"><i class="far fa-copyright fa-fw"></i><span itemprop="copyrightYear">2021</span><span class="author" itemprop="copyrightHolder">&nbsp;<a href="/" target="_blank">早起的年轻人</a></span>&nbsp;|&nbsp;<span class="license"><a rel="license external nofollow noopener noreffer" href="https://creativecommons.org/licenses/by-nc/4.0/" target="_blank">CC BY-NC 4.0</a></span></div>
        </div>
    </footer></div>

        <div id="fixed-buttons"><a href="#" id="back-to-top" class="fixed-button" title="回到顶部">
                <i class="fas fa-arrow-up fa-fw"></i>
            </a><a href="#" id="view-comments" class="fixed-button" title="查看评论">
                <i class="fas fa-comment fa-fw"></i>
            </a>
        </div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/cookieconsent@3.1.1/build/cookieconsent.min.css"><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/smooth-scroll@16.1.3/dist/smooth-scroll.min.js"></script><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/autocomplete.js@0.37.1/dist/autocomplete.min.js"></script><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/algoliasearch@4.2.0/dist/algoliasearch-lite.umd.min.js"></script><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/lazysizes@5.2.2/lazysizes.min.js"></script><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/clipboard@2.0.6/dist/clipboard.min.js"></script><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/sharer.js@0.4.0/sharer.min.js"></script><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/cookieconsent@3.1.1/build/cookieconsent.min.js"></script><script type="text/javascript">window.config={"code":{"copyTitle":"复制到剪贴板","maxShownLines":10},"comment":{},"cookieconsent":{"content":{"dismiss":"同意","link":"了解更多","message":"本网站使用 Cookies 来改善您的浏览体验."},"enable":true,"palette":{"button":{"background":"#f0f0f0"},"popup":{"background":"#1aa3ff"}},"theme":"edgeless"},"search":{"algoliaAppID":"PASDMWALPK","algoliaIndex":"index.zh-cn","algoliaSearchKey":"b42948e51daaa93df92381c8e2ac0f93","highlightTag":"em","maxResultLength":10,"noResultsFound":"没有找到结果","snippetLength":50,"type":"algolia"}};</script><script type="text/javascript" src="/js/theme.min.js"></script></body>
</html>
